namespace ReportToolAPI.Models
{
    /// <summary>
    /// API 统一响应模型
    /// </summary>
    public class ApiResponse<T>
    {
        public int Code { get; set; } = 200;
        public bool Success { get; set; } = true;
        public string Message { get; set; } = string.Empty;
        public T? Data { get; set; }

        public static ApiResponse<T> Ok(T? data = default, string message = "操作成功")
        {
            return new ApiResponse<T>
            {
                Code = 200,
                Success = true,
                Message = message,
                Data = data
            };
        }

        public static ApiResponse<T> Fail(string message, int code = 400)
        {
            return new ApiResponse<T>
            {
                Code = code,
                Success = false,
                Message = message,
                Data = default
            };
        }
    }
}




